program main
    implicit none
    integer :: i,it,range=500,min=0,err
    real :: rt
    open(233,file='7-1-integer.dat',form='UNFORMATTED',access='SEQUENTIAL')
    call random_seed()
    do i=1,50
        call random_number(rt)
        it = int(rt*range)+min
        write(233)it
    end do
    rewind(233)
    open(520,file='7-1-sorted.dat',form='UNFORMATTED',access='SEQUENTIAL')
    err=0
    do while(.true.)
        read(233,iostat=err)it
        if(err==0)then
            if(mod(it,2)==0)then
                write(520)it
            end if
        else
            exit
        end if
    end do
end program
